package com.github.dengmin.mysql.mapper;

import com.github.dengmin.mysql.model.Permission;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Author dengmin
 * @Created 2020/8/30 上午10:58
 */
public class PermissionRowMapper implements RowMapper<Permission> {
    private static final long serialVersionUID = 1L;
    
    @Override
    public Permission mapRow(ResultSet rs, int i) throws SQLException {
        Permission permission = new Permission();
        permission.setId(rs.getLong("id"));
        permission.setCode(rs.getString("code"));
        permission.setName(rs.getString("name"));
        permission.setParentId(rs.getLong("parentId"));
        permission.setUrl(rs.getString("url"));
        permission.setGmtCreated(rs.getTimestamp("gmtCreated"));
        permission.setGmtModify(rs.getTimestamp("gmtModify"));
        return permission;
    }
}
